From fb3841431b42fbd3d5c16f84ea64b2810d62f489 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Mon, 5 Sep 2005 18:55:08 +0000 Subject: [PATCH] Fix command line argument parsing. Signed-off-by: Christian Limpach --- tools/xenstore/xenstored_core.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 4d9910030c..4aef491ce1 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1628,12 +1628,13 @@ static void daemonize(void) } -static struct option options[] = { { "no-fork", 0, NULL, 'N' }, - { "verbose", 0, NULL, 'V' }, - { "output-pid", 0, NULL, 'P' }, - { "trace-file", 1, NULL, 'T' }, - { "pid-file", 1, NULL, 'F' }, - { NULL, 0, NULL, 0 } }; +static struct option options[] = { + { "pid-file", 1, NULL, 'F' }, + { "no-fork", 0, NULL, 'N' }, + { "output-pid", 0, NULL, 'P' }, + { "trace-file", 1, NULL, 'T' }, + { "verbose", 0, NULL, 'V' }, + { NULL, 0, NULL, 0 } }; int main(int argc, char *argv[]) { @@ -1644,14 +1645,15 @@ int main(int argc, char *argv[]) bool outputpid = false; const char *pidfile = NULL; - while ((opt = getopt_long(argc, argv, "DVT:", options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "F:NPT:V", options, + NULL)) != -1) { switch (opt) { + case 'F': + pidfile = optarg; + break; case 'N': dofork = false; break; - case 'V': - verbose = true; - break; case 'P': outputpid = true; break; @@ -1662,8 +1664,9 @@ int main(int argc, char *argv[]) optarg); write(tracefd, "\n***\n", strlen("\n***\n")); break; - case 'F': - pidfile = optarg; + case 'V': + verbose = true; + break; } } if (optind != argc) -- 2.30.2